package com.micro.form;

import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;

import java.io.IOException;

public class EditTaskForm {

    private static Stage stage = new Stage();
    static{
        try {
            Scene scene = new Scene(FXMLLoader.load(EditTaskForm.class.getResource("EditForm.fxml")));
            stage.setTitle("新增/修改");
            stage.setScene(scene);
            stage.setResizable(false);
            stage.setAlwaysOnTop(true);
            //窗口关闭时，显示主窗口
            stage.setOnCloseRequest((e)->{
                MainForm.show();
            });
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public static void onShow(EventHandler<WindowEvent> e){
        stage.setOnShowing(e);
    }

    public static void show() {

        stage.show();
    }
    public static boolean isShow(){
        return stage.isShowing();
    }
    public static void hidden(){
        stage.hide();
    }
}
